// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   pdf_ok.java

package hr.export;

import include.excel_export.*;
import include.get_sql.getKeyColumn;
import include.nseer_cookie.MakePdf;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class pdf_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;
	nseer_db_backup1 erp_db;

	public pdf_ok()
	{
		erp_db = null;
	}

	public synchronized void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			HttpSession session = request.getSession();
			java.io.PrintWriter out = response.getWriter();
			excel query = new excel();
			XlsWriter xls = new XlsWriter();
			MakePdf mm = new MakePdf();
			mm.setConfigFile("xml/hr/pdf_export.xml");
			excel_three query_three = new excel_three();
			getKeyColumn column = new getKeyColumn();
			String sql = "";
			String tablename = request.getParameter("tablename");
			String condition = "";
			String queue = "";
			if (tablename.equals("hr_file"))
			{
				condition = "where check_tag='1'";
				queue = "order by register_time";
			} else
			{
				tablename = "hr_questiones";
			}
			sql = (new StringBuilder("select * from ")).append(tablename).append(" ").append(condition).append(" ").append(queue).toString();
			int a = sql.indexOf("*");
			String sqla = (new StringBuilder(String.valueOf(sql.substring(0, a)))).append("count(*) as A").append(sql.substring(a + 1, sql.length())).toString();
			mm.make((String)dbSession.getAttribute("unit_db_name"), tablename, sqla, sql, "pdf_files/hr_data", 1500, session);
			int fileAmount = mm.fileAmount();
			response.sendRedirect((new StringBuilder("hr/export/pdf_ok_a.jsp?file_amount=")).append(fileAmount).toString());
		}
		catch (Exception exception) { }
	}
}
